//
//  FreindCell.m
//  MooreDoll
//
//  Created by 郭景豪 on 2014/11/30.
//  Copyright (c) 2014年 Tank. All rights reserved.
//

#import "FreindCell.h"
#import "RoundImage.h"
@implementation FreindCell
@synthesize LB_nickName,IV_userPic;

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setCellWithRoster:(FriendRoster *)roster{
    
    NSString *nickName      = roster.nickName;
    
    NSString *userImgPath = [NSString stringWithFormat:@"%@/%@",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0],roster.imagePath];
    
    NSLog(@"%@",userImgPath);
    NSData   *userImgData   = [[NSFileManager defaultManager] contentsAtPath:userImgPath];
    UIImage  *userImg       = nil;
    if (userImgData!=nil)
      userImg = [[UIImage alloc] initWithData:userImgData];
    
    LB_nickName.text = nickName;
    
    if (userImg!=nil)
    {
        [IV_userPic setImage:userImg];
        [IV_userPic setImage:[RoundImage maskImage:userImg withMask:[UIImage imageNamed:@"mask"]]];
    }
    else
    {
        
        [IV_userPic setImage:[UIImage imageNamed:@"dficon_user"]];

    }
    

    
    self.cellsRoster = roster;
}

- (void)setcellWitNoHaveToy
{
    LB_nickName.text = NSLocalizedString(@"尚未新增娃娃", nil);
    [IV_userPic setImage:[UIImage imageNamed:@"dficon_modo"]];
    
}

@end
